package com.caipu.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.caipu.entity.DishSelection;
import com.caipu.mapper.DishSelectionMapper;
import com.caipu.service.DishSelectionService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

@Service
public class DishSelectionServiceImpl extends ServiceImpl<DishSelectionMapper, DishSelection> implements DishSelectionService {
    
    @Override
    public void recordSelection(Long userId, Long dishId, Integer status, String rejectReason) {
        DishSelection selection = new DishSelection();
        selection.setUserId(userId);
        selection.setDishId(dishId);
        selection.setStatus(status);
        selection.setRejectReason(rejectReason);
        selection.setCreateTime(LocalDateTime.now());
        
        this.save(selection);
    }
}